//目的是为了维护请求封装
import type { AxiosPromise } from "axios";
import request from "../request";
import type { SunnyModule } from "@/types/sunnyModule/type";

//请求module列表的方法
export function listModuleApi(): AxiosPromise<SunnyModule[]> {
  return request({
    url: "/sunnyModule",
    method: "get",
  });
}
//新增模块方法
export function addModuleApi(data: SunnyModule): AxiosPromise<any> {
  return request({
    url: "sunnyModule",
    method: "post",
    data,
  });
}

export function updateModuleApi(data: SunnyModule): AxiosPromise<any> {
  return request({
    url: "sunnyModule",
    method: "put",
    data,
  });
}

export function deleteModuleApi(moduleId: number): AxiosPromise<any> {
  return request({
    url: "sunnyModule/" + moduleId,
    method: "delete",
  });
}
